package com.wireless.action;

import java.util.List;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import com.wireless.base.BaseAction;
import com.wireless.entity.Menutypetbl;
import com.wireless.entity.Tabletbl;
import com.wireless.service.MenuService;
import com.wireless.service.TableService;

@Namespace("/menu")
@ParentPackage("json-default")
@Controller
public class MenutypeAction extends BaseAction {
	private Menutypetbl menutype;
	private List<Menutypetbl> menutypelist;
	@Autowired
	private MenuService menuService;

	@Action(value = "class", results = { @Result(name = "success", location = "/views/menutype/menutype.jsp") })
	public String getTableList() {
		menutypelist = menuService.getMenuTypeList();
		return SUCCESS;
	}

	@Action(value = "addMenutype", results = { @Result(name = "success", location = "/views/menutype/menutype.jsp") })
	public String addMenutype() {
		menuService.addMenutype(menutype);
		menutypelist = menuService.getMenuTypeList();
		return SUCCESS;
	}

	@Action(value = "delMenutype", results = { @Result(name = "success", location = "/views/menutype/menutype.jsp") })
	public String delMenutype() {
		menuService.delMenutype(menutype.getId());
		menutypelist = menuService.getMenuTypeList();
		return SUCCESS;
	}

	public Menutypetbl getMenutype() {
		return menutype;
	}

	public void setMenutype(Menutypetbl menutype) {
		this.menutype = menutype;
	}

	public List<Menutypetbl> getMenutypelist() {
		return menutypelist;
	}

	public void setMenutypelist(List<Menutypetbl> menutypelist) {
		this.menutypelist = menutypelist;
	}

}
